<!--
 * @Date: 2021-12-14 10:47:22
 * @LastEditors: LeeKing
 * @LastEditTime: 2021-12-19 15:57:37
 * @FilePath: \admin\src\views\authority\rights\index.vue
-->
<template>
  <div>
    <el-card class="box-card">
      <el-table :data="tableData" style="width: 100%" border>
        <el-table-column label="#" width="55" type="index" />
        <el-table-column label="权限名称" width="524" prop="authName" />
        <el-table-column label="路径" width="524" prop="path" />
        <el-table-column label="权限等级" width="524">
          <template scope="scope">
            <el-button
              v-if="Number(scope.row.level) === 0"
              type="primary"
              plain
              disabled
              size="mini"
            >一级</el-button>
            <el-button
              v-else-if="Number(scope.row.level) === 1"
              type="success"
              plain
              disabled
              size="mini"
            >二级</el-button>
            <el-button
              v-else
              type="warning"
              plain
              disabled
              size="mini"
            >三级</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { getAuthorityList } from '@/api/authority.js'
export default {
  data() {
    return {
      tableData: []
    }
  },

  created() {
    this.loadAuthorityList()
  },

  methods: {
    async loadAuthorityList() {
      const res = await getAuthorityList('list')
      console.log(res)
      this.tableData = res.data
    }
  }
}
</script>

<style scoped lang="less"></style>
